<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>循环</title>
		<style type="text/css">
			table {
				width: 600px;
				border-collapse: collapse;
			}

			table th {
				border: #000000 1px solid;
			}
		</style>
	</head>
	<body>
		<script type="text/javascript">//			控制纵向的循环
			document.write("<table>");
			for(var l = 1; l <= 9; l++) {
				//				控制水平方向的循环
				document.write("<tr>");
				for(var m = 1; m <= l; m++) {
					document.write("<th>" + l + "*" + m + "=" + (l * m) + "</th>")
				}
				document.write("<tr/>")			
			}
			document.write("</tr>");
			document.write("</table>");
			document.write("<table>");
			for(var o = 9; o > 0; o--) {
				document.write("<tr>");	
				//控制水平方向的循环
				for(var p = 1; p <= o; p++) {
					document.write("<th>" +p + "*" + o + "=" + (p * o)+ "</th>")
				}
				document.write("<tr/>")
			}
			document.write("</tr>");
			document.write("</table>");			
		</script>
	</body>
</html>

